home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11541 < prev    next >
Encoding:
Text File  |  1996-08-05  |  678 b   |  30 lines

  1. Newsgroups: comp.lang.c
  2. Path: howland.reston.ans.net!torn!news!kima
  3. From: kima@uwindsor.ca (Sam Kim)
  4. Subject: Need to get value from 2-D matrix
  5. X-Nntp-Posting-Host: server.uwindsor.ca
  6. Message-ID: <DotDpo.6o2@news.uwindsor.ca>
  7. Sender: news@news.uwindsor.ca (Usenet)
  8. Organization: University of Windsor
  9. Date: Mon, 25 Mar 1996 08:17:48 GMT
  10.  
  11.  
  12. I'm writing a program that reads in a 2-D matrix from binary.  I am
  13. useless with structures, so I'm trying to do this with arrays and
  14. pointers.
  15.  
  16. Question :  How do I read in the values?
  17.  
  18. I have : 
  19.  
  20. for (i=0; i<n; i++)
  21.   for (j=0; j<n; j++)
  22.     {
  23.       fread(&ptr,1,1,fp)
  24.       matrix[i][j] = ptr;
  25.       ptr++;
  26.     }
  27.  
  28. Shouldn't this work?
  29.  
  30.